package actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 * 扩展Struts的ForwardAction，增加Token支持（通过saveToken(request)），适用于显示 输入界面的forward.
 * action，需要和html:form标签一起使用
 * @author spring
 */

public class TokenSupportedForwardAction extends Action {
    /**
     * @param mapping action mapping
     * @param form action form
     * @param request request
     * @param response response
     * @return action form
     * @throws Exception any exception
     */
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        // 产生并保存Token,防止重复提交
        saveToken(request);
        return mapping.findForward("success");

    }
}
